package com.gc;

/**
 * @author xiangui
 * 描述:
 * 时间: Create in 13:45 2018/7/18
 */
public class KillLock {

    static class SynAddRunable implements Runnable{

        int a, b;

        public SynAddRunable(int a, int b){
            this.a = a;
            this.b = b;
        }
        @Override
        public void run() {
            synchronized (Integer.valueOf(a)){
                synchronized (Integer.valueOf(b)){
                    System.out.println(a + b);
                }
            }
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++){
            //创建的俩那个模拟线程
            new Thread(new SynAddRunable(1,2)).start();
            new Thread(new SynAddRunable(2,1)).start();
        }
    }

}
